<script setup lang="ts">

import DropSelctBase from "~/components/ai/DropSelctBase.vue";
const {
  narrator_voice_id,
  voiceModels
} = storeToRefs(useWorkEditStore())
/**
 * 配音选项
 */
interface options {
  title: string
  value: number
}

const narrator_voice_options = ref<options[]>([])
voiceModels.value.forEach((item) => {
  narrator_voice_options.value.push({title: item.name, value: item.id})
})

/**
 * 监听声音模型的更新，同步之后立即更新选项
 */
watch(voiceModels, () => {
  narrator_voice_options.value = []
  voiceModels.value.forEach((item) => {
    narrator_voice_options.value.push({title: item.name, value: item.id})
  })
}, {
  deep: true
})
</script>

<template>
  <drop-selct-base v-model="narrator_voice_id" :options="narrator_voice_options"></drop-selct-base>
</template>

<style scoped lang="scss">

</style>